import request from '@/utils/_request'
// import { id } from 'element-plus/es/locale/index.js'
// import { isDate } from 'element-plus/es/utils/types.js'

// 查询岗位列表
export function listPost(query) {
  const data = {
    query
  }
  return request({
    url: '/admin/post/query',
    method: 'post',
    data: data
  })
}

// 查询岗位详细
export function getPost(postId) {
  return request({
    url: '/admin/post/queryById/' + postId,
    method: 'get'
  })
}

// 新增岗位
export function addPost(data) {
  return request({
    url: '/admin/post/add',
    method: 'post',
    data: data
  })
}

// 修改岗位
export function updatePost(data) {
  return request({
    url: '/admin/post/edit',
    method: 'put',
    data: data
  })
}

// 删除岗位
export function delPost(postId) {
  const data = {
    id: null,
    ids: null
  }
  if (postId !== undefined && postId.length() > 1 ) {
    data.id = postId
  }else {
    data.ids = postId
  }

  return request({
    url: '/admin/post/delete',
    method: 'delete',
    data : data
  })
}
